/*
 * Copyright (c)  2017
 * All rights reserved.
 * LotteryEntity.java 2017-09-17 下午2:07
 */

package com.ueboot.weishop.entity.lottery;

import com.ueboot.weishop.entity.IDEntity;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.GenericGenerator;

import javax.persistence.*;

/**
 * 描述:抽奖信息表
 * 定义抽奖具体的规则.中奖规则，中奖结果
 *
 * @author yangkui create on 2017-09-17 下午2:07.
 * @since 1.0
 */
@Data
@NoArgsConstructor
@Entity(name = "WS_LOTTERY_INFO")
public class LotteryInfoEntity extends IDEntity {
    @Id
    @GeneratedValue(strategy = GenerationType.TABLE, generator = "WS_LOTTERY_INFO")
    @GenericGenerator(name = "WS_LOTTERY_INFO", strategy = "enhanced-table", parameters = {
            @org.hibernate.annotations.Parameter(name = "table_name", value = "WS_TABLE_SEQUENCE"),
            @org.hibernate.annotations.Parameter(name = "segment_value", value = "WS_LOTTERY_INFO"),
            @org.hibernate.annotations.Parameter(name = "optimizer", value = "pooled")})
    @Column(name = "ID", columnDefinition = "INT(20) COMMENT 'id主键'", length = 20)
    private Long id;

    /**
     * 作用域:支付前|支付后
     */
    @Column(name = "SCOPE",columnDefinition = "VARCHAR(40) COMMENT '作用域:支付前|支付后'",length = 40)
    private String scope;

    /**
     * 中奖概率最大值，分母值
     */
    @Column(name = "TOTAL_PROBABILITY",columnDefinition = "INT(11) COMMENT '中奖概率最大值，分母值'",length = 11)
    private int totalProbability;

    /**
     * 中奖概率值，分子值
     */
    @Column(name = "PROBABILITY",columnDefinition = "INT(11) COMMENT '中奖概率值，分子值'",length = 11)
    private int probability;

    /**
     * 最高可中奖数量，控制某一个中奖发放的最大数量
     */
    @Column(name = "MAX_COUNT",columnDefinition = "INT(11) COMMENT '最高可中奖数量，控制某一个中奖发放的最大数量'",length = 11)
    private int maxCount;

    /**
     * 是否允许重复中奖，同一个抽奖活动，根据用户ID判断是否允许重复中奖
     */
    @Column(name = "REPEAT_LOTTERY",columnDefinition = "INT(1) COMMENT '是否允许重复中奖，同一个抽奖活动，根据用户ID判断是否允许重复中奖'",length = 1)
    private  Boolean repeatLottery;

    //--中奖内容。可以是直接打折、或者减去金额、免单

    /**
     * 中奖结果类型（只可同时有一种）：打折|减去金额|免单|发放优惠券
     */
    @Column(name = "WIN_TYPE",columnDefinition = "VARCHAR(40) COMMENT '中奖结果类型（只可同时有一种）：打折|减去金额|免单|发放优惠券'",length = 40)
    private String winType;

    /**
     * 折扣值，具体的折扣值，采用【1-10】
     */
    @Column(name = "DISCOUNT_VALUE",columnDefinition = "INT(11) COMMENT '折扣值，具体的折扣值，采用【1-10】'",length = 11)
    private int discountValue;
    /**
     * 折扣，直接减去的价格(单位分)
     */
    @Column(name = "DISCOUNT_MINUS_PRICE",columnDefinition = "INT(11) COMMENT '折扣，直接减去的价格(单位分)'",length = 11)
    private int discountMinusPrice;

    /**
     * 是否免单
     */
    @Column(name = "FREE",columnDefinition = "INT(1) COMMENT '是否免单'",length = 1)
    private Boolean free;

    //优惠券信息,根据这个基础信息给客户发送一条优惠券
    /**
     * 优惠券名称
     */
    @Column(name = "COUPON_NAME",columnDefinition = "VARCHAR(200) COMMENT '优惠券名称'",length = 200)
    private String couponName;

    /**
     * 优惠券有效天数
     */
    @Column(name = "COUPON_EXPIRE_DAY",columnDefinition = "INT(11) COMMENT '优惠券有效天数'",length = 11)
    private int couponExpireDay;

    /**
     * 优惠券使用时最小商品价格
     */
    @Column(name = "COUPON_MIN_GOODS_PRICE",columnDefinition = "INT(11) COMMENT '优惠券使用时最小商品价格'",length = 11)
    private int couponMinGoodsPrice;
    /**
     * 优惠券使用时最大商品价格
     */
    @Column(name = "COUPON_MAX_GOODS_PRICE",columnDefinition = "INT(11) COMMENT '优惠券使用时最大商品价格'",length = 11)
    private int couponMaxGoodsPrice;
}